/*
#include<iostream> 
using namespace std;

class application
{
public:
       static void f();
       static void g();
private:
        static int global;
} ;

int application::global = 0;
void application :: f()
{
     global = 5;     
}
 
void application :: g()
{
     cout<<global<<endl;
}

int main()
{
    application ::f();
    application ::g();
    system("pause");
    return 0; 
}
*/

#include<iostream>
using namespace std;

class Student
{
public:
       Student(int StudentNo=0)
       {
           cout<<"create one student"<<endl;
           NoOfStudents++;
           cout<<"NoOfStudents "<<NoOfStudents;
           StudentNo=9022100+NoOfStudents;
           cout<<"StudentNO " <<StudentNo<<endl; 
       }
       ~Student()
       {
           cout<<"destruct one student"<<endl;
           NoOfStudents--;
       }
       static int number()
       {   return NoOfStudents;   }
protected:
          static int NoOfStudents;
          int StudentNo;
};

int Student::NoOfStudents = 0 ;

void fn()
{
     Student s1;
     Student s2;
     cout<<Student::number()<<endl; 
} 

int main()
{
    fn();
    cout<<Student::number()<<endl;
    system("pause")    ;
    return 0;
}
